﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AbstractFactory.Table
{
    internal class TablePage : Page
    {
        public TablePage(string title, string author) : base(title, author)
        {
        }

        public override string MakeHtml()
        {
            var buffer = new StringBuilder();
            buffer.Append($"<html><head><title>{title}</title></head>\n");
            buffer.Append("<body>");
            buffer.Append($"<h1>{title}</h1>");
            buffer.Append("<table width=\"100%\" border=\"3\"><tr>");
            foreach (var item in content)
            {
                buffer.Append($"<tr>{item.MakeHtml()}</tr>" );
            }
            buffer.Append("</table>\n");
            buffer.Append($"<hr><address>{author}</address>\n");
            buffer.Append("</body></html>");
            return buffer.ToString();
        }
    }
}
